package net.telesing.tcmc.common;

import org.nutz.dao.DB;
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.Next;
import org.nutz.dao.entity.annotation.SQL;

import java.io.Serializable;

/**
 * IdModel，供model继承
 *
 * Created by Zmt on 2015/11/3.
 */
public class IdModel implements Serializable
{
    public final static String SQL_MYSQL_GetNewId  = "SELECT LAST_INSERT_ID()";
    public final static String SQL_ORACLE_GetNewId = "SELECT SEQ_BASE.CURRVAL FROM dual";

    @Id
    @Next({@SQL(db = DB.MYSQL, value = SQL_MYSQL_GetNewId), @SQL(db = DB.ORACLE, value = SQL_ORACLE_GetNewId)
    })
    private Long id;

    public Long getId()
    {
        return id;
    }

    public void setId(Long id)
    {
        this.id = id;
    }

}
